<template>
	<view class="c-list">
		<view v-if="dataArr.length>0">
			<c-item v-for="data in dataArr" :key="data.id" :data="data" @click="handleClick"></c-item>
		</view>
		<view v-else class="no-data-remark">
			<image class="icon" src="../../static/img/no-data.png" mode=""></image>
			<view class="remark">
				暂无数据
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "c-list",
		props: {
			dataArr: {
				type: Array,
				default () {
					return [];
				}
			}
		},
		methods: {
			handleClick(data) {
				this.$emit('click', data);
			}
		}
	}
</script>

<style lang="scss">
	.c-list {
		.no-data-remark {
			color: $uni-text-color-grey;
			display: flex;
			flex-direction: column;
			align-items: center;
			padding-top: 50%;

			.icon {
				width: 80rpx;
				height: 80rpx;
			}

			.remark {
				padding-top: 10rpx;
			}
		}
	}
</style>
